#include "point.h"
#include "contour.h"
#include "polygon.h"
#include "rayintersections.h"
#include "grid.h"
#include "cell.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <iosfwd>
#include <iterator>


int main()
{
    std::vector<manhattan_line_t> m_line;
    m_line.push_back(manhattan_line_t(point_t(2, 4), point_t(6, 1)));
    m_line.push_back(manhattan_line_t(point_t(2, 3), point_t(2, 1)));
    m_line.push_back(manhattan_line_t(point_t(4, 5), point_t(1, 3)));

    m_line.push_back(manhattan_line_t(point_t(4, 3), point_t(6, 2)));
    m_line.push_back(manhattan_line_t(point_t(2, 1), point_t(6, 1)));
    m_line.push_back(manhattan_line_t(point_t(5, 4), point_t(5, 0)));
    segment_t seg(point_t(0, 0), point_t(5, 5));
    for(size_t i = 0; i < m_line.size(); ++i)
    {
        std::cout << m_line[i].intersects(seg) << "; must be: " << !(i / 3) << std::endl;
    }

    less_by_angle min(segment_t(point_t(0, 0), point_t(20, 0)));
    std::cout << min(segment_t(point_t(1, -1), point_t(20, 1)), segment_t(point_t(1, -1), point_t(20, 0.5))) << std::endl;
    std::cout << min(segment_t(point_t(1, -1), point_t(20, 0.5)), segment_t(point_t(1, -1), point_t(20, 1))) << std::endl;

    std::cout << min(segment_t(point_t(1, -1), point_t(20, 1)), segment_t(point_t(1, -1), point_t(20, 0.5))) << std::endl;
    std::cout << min(segment_t(point_t(20, 0.5), point_t(1, -1)), segment_t(point_t(1, -1), point_t(20, 1))) << std::endl;
    return 0;
}
